#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package};

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * demo启动类
 *
 * @author win11
 */
@Slf4j
@SpringBootApplication(scanBasePackages = "${groupId}")
@EnableKnife4j
@MapperScan("${package}.infras.repository.mapper")
@EnableAspectJAutoProxy(proxyTargetClass = true)
public class DemoApplication {
    public static void main(String[] args) throws UnknownHostException {

        ConfigurableApplicationContext application = SpringApplication.run(DemoApplication.class, args);
        Environment env = application.getEnvironment();
        String appName = env.getProperty("spring.application.name");
        String appPort = env.getProperty("server.port");
        String localIp = InetAddress.getLocalHost().getHostAddress();
        String username = env.getProperty("knife4j.basic.username");
        String password = env.getProperty("knife4j.basic.password");
        log.info("${symbol_escape}n----------------------------------------------------------${symbol_escape}n${symbol_escape}t" +
                        "Application '{}' is running! Access URLs:${symbol_escape}n${symbol_escape}t" +
                        "Local: ${symbol_escape}t${symbol_escape}thttp://localhost:{}${symbol_escape}n${symbol_escape}t" +
                        "External: ${symbol_escape}thttp://{}:{}${symbol_escape}n${symbol_escape}t" +
                        "Doc: ${symbol_escape}thttp://{}:{}/doc.html${symbol_escape}t" +
                        "账户名：{}${symbol_escape}t"+
                        "密码：{}${symbol_escape}t${symbol_escape}n" +
                        "----------------------------------------------------------",
                appName,
                appPort,
                localIp, appPort,
                localIp, appPort,
                username,
                password);
    }

}
